Skip to content

Retry stream read errors in SimpleDownloader#581

Open
agoncharov-reef wants to merge 7 commits into
Backblaze:masterfrom
reef-technologies:retry-on-mid-stream-read-errors
Open

Retry stream read errors in SimpleDownloader#581
agoncharov-reef wants to merge 7 commits into
Backblaze:masterfrom
reef-technologies:retry-on-mid-stream-read-errors

Conversation

@agoncharov-reef

Copy link
Copy Markdown
Contributor

SimpleDownloader already had range-based retry logic for truncated downloads (e.g. when the server closes the connection mid-stream), but ChunkedEncodingError, ConnectionError, and ContentDecodingError raised during iter_content bypassed that path and failed the download immediately.

This PR catches those exceptions during both the initial read and follow-up range requests, logs them at debug level, and lets the existing retry loop resume. Retry is skipped when content is decoded (content_encoding set and decode_content=True), since a partially decoded stream cannot be resumed with byte ranges.

Also fixes v1.B2Api not exposing api_config, and ensures decoded downloads still get truncation checks after download (hash verification remains skipped for them).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant